package com.hskn.hss.module.totalcost.ienum;

public enum CarExpenseType {

    ALL("全部",0),
    VEHICLEINSPECTIONFEE("车检费", 1),
    VEHICLEINSURANCEPREMIUM("保险费", 2),
    VEHICLEMAINTENANCEFEE("保养费", 3),
    MISCELLANEOUSEXPENSES("车杂费", 4),
    OILCOST("油费", 5),
    VEHICLEMAINTENANCECOST("维修费", 6),
    VEHICLEVIOLATIONFEE("违章费", 7);
    // 成员变量  
    private String name;  
    private int index;  
    // 构造方法  
    private CarExpenseType(String name, int index) {
        this.name = name;  
        this.index = index;  
    }  
    // 普通方法  
    public String getNameByIndex(int index) {
        for (CarExpenseType c : CarExpenseType.values()) {
            if (c.getIndex() == index) {  
                return c.name;  
            }  
        }  
        return null;  
    }  
    // 普通方法
    public Integer getIndexByName(String name) {
        for (CarExpenseType c : CarExpenseType.values()) {
            if (c.getName() .equals(name)) {
                return c.index;
            }
        }
        return null;
    }
    // get set 方法
    public String getName() {  
        return name;  
    }  
    public void setName(String name) {  
        this.name = name;  
    }  
    public int getIndex() {  
        return index;  
    }  
    public void setIndex(int index) {  
        this.index = index;  
    }  
}  